import QtQuick 1.1
import com.meego 1.0
import "CommomUtil.js" as Util
import "Forum.js" as ForumUtil
import "database.js" as DataBaseUtil

ToolBarLayout{
    id: container
    width: 480; height: 73

    property int currentChecked: 0
    property bool isExite: false

    signal favorited

    //返回
//    Image{
//        id:back_image
//        source:"../images/toolbar/btn_back.png"
//        anchors.left: container.left
//        anchors.verticalCenter: container.verticalCenter

//    }

//    ToolButton{
//        id: back_bt
//        width: back_image.width; height: back_image.height
//        anchors.left: back_image.left; anchors.bottom: back_image.bottom
//       // iconSource: "../images/toolbar/btn_back.png"
//        platformStyle: toolBar_style
//        onClicked: {
//            Util.back();//返回到文章列表
//        }
//    }
    ToolIcon{
        id: back_bt_icon
        width: container.width / 6; height: container.height
        anchors.left: container.left; anchors.bottom: container.bottom
        iconId: "toolbar-back"
        platformStyle: toolBar_style
        onClicked: {
                  Util.back();//返回到文章列表
        }
    }
   Rectangle{
       id:type_rect
       anchors.left: back_bt_icon.right
       anchors.top: back_bt_icon.top
       anchors.topMargin: 10
       anchors.bottomMargin: 10
       anchors.bottom: back_bt_icon.bottom
       anchors.leftMargin: 56
       anchors.horizontalCenter: back_bt_icon.horizontalCenter
       anchors.verticalCenter: back_bt_icon.verticalCenter

       width:208

    Image{
          id: all_image
          source:"../images/forum/btn_l_down.png"
           //../imges/forum/btn_l_down.png
          anchors.left: type_rect.left

          anchors.verticalCenter: type_rect.verticalCenter
        Text{
            id:all_club
            text:"查看全部"
            color:"white"
            font { bold: true; family: "Helvetica"; pointSize: 15 }
            anchors.centerIn: parent
        }

     }
     ToolButton {
         id: all_club_btn
         width:all_image.width; height: all_image.height
         anchors.left: all_image.left; anchors.bottom: all_image.bottom
         platformStyle: toolBar_style
         onClicked: {
             all_image.source="../images/forum/btn_l_down.png"
             all_club.color="white"
             //
             jinhua_club_image.source="../images/forum/btn_r_up.png"
             jinhua_club_text.color="black"

            forum_main.changeModelList("0")
         }
     }

    Image{
           id:jinhua_club_image

           source: "../images/forum/btn_r_up.png"
           //../images/forum/btn_r_down.png
           anchors.left: all_image.right

           Text{
               id:jinhua_club_text
               text:"精华帖"
               color:"black"
               font { bold: true; family: "Helvetica"; pointSize: 15 }
                anchors.left: parent.left
                anchors.leftMargin: 2
                 anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
           }
     }
    ToolButton {
        id: jinhua_club_btn
        width:jinhua_club_image.width; height: jinhua_club_image.height
        anchors.left: jinhua_club_image.left; anchors.bottom: jinhua_club_image.bottom
        platformStyle: toolBar_style
        onClicked: {
            all_image.source="../images/forum/btn_l_up.png"
            all_club.color="black"
            //
            jinhua_club_image.source="../images/forum/btn_r_down.png"
            jinhua_club_text.color="white"

            forum_main.changeModelList("1")
        }
    }

   }


//    //收藏
//    Image{
//        id: comment_image
//        source:"../images/forum/ico.png"
//        anchors.right: container.right
//        anchors.rightMargin: 32
//        anchors.verticalCenter: container.verticalCenter
//    }


//    ToolButton {
//        id: comment_btn
//        width:comment_image.width; height: comment_image.height
//        anchors.left: comment_image.left; anchors.bottom: comment_image.bottom
//        platformStyle: toolBar_style
////        onClicked: {
////            DataBaseUtil.addForumFavorite(forum_main.currentForumId,forum_main.simpleName,forum_main.forumMainImageUrl);

////        }
//        onClicked: { // 添加到收藏夹
//            container.favorited();
//        }

//    }
    ToolButton {
        id: others_bt
        iconSource: container.isExite ? "../images/favorite/ico1.png" : "../images/modelslib/info_ico.png"
        width: container.width / 6; height: container.height
        anchors.right: container.right; anchors.bottom: container.bottom
        onClicked: { // 添加到收藏夹
            container.favorited();
        }

        platformStyle: toolBar_style
    }


    ToolButtonStyle{
        id: toolBar_style
        backgroundVisible: false
        pressedBackground: "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-pressed"
    }
}
